package com.ant.storage.controller;


import com.ant.storage.common.ResultCode;
import com.ant.storage.common.ResultPage;
import com.ant.storage.common.ResultVo;
import com.ant.storage.dto.CarSupplierOrderDto;
import com.ant.storage.dto.PickingDto;
import com.ant.storage.dto.SupplierOrderDto;
import com.ant.storage.dto.SupplierPayListDto;
import com.ant.storage.service.ICarSupplierPayService;
import com.ant.storage.service.ISupplierPayListService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author melon
 * @since 2024-01-03
 */
@RestController
@RequestMapping("/car-supplier-pay")
public class CarSupplierPayController {
    @Autowired
    private ICarSupplierPayService supplierPayService;

    @ApiOperation(value = "获取供应商供货信息")
    @PostMapping("/getSupplierPayList")
    public ResultPage getSupplierPayList(SupplierPayListDto dto) {
        return ResultPage.success("获取成功", supplierPayService.querylist(dto));
    }

    @ApiOperation(value = "通过id查询供应商采购新分页")
    @GetMapping("/findPaymenPageListById")
    public ResultPage findPaymenPageListById(SupplierOrderDto dto) {
        if (dto.getId() == null) {
            return ResultPage.fail(ResultCode.PARAM_IS_BLANK);
        } else {
            return ResultPage.success("查询采购",supplierPayService.findPaymenList(dto));
        }
    }

    @ApiOperation(value = "通过id查询供应商采购新分页")
    @PostMapping("/SupplierSettlementSave")
    public ResultVo SupplierSettlementSave(@RequestBody CarSupplierOrderDto dto) {
            return supplierPayService.SupplierSettlementSave(dto);
    }

}
